package com.wang.home.find;

import com.alibaba.fastjson.JSONObject;
import com.wang.home.HomeReq;
import com.wang.tool.dagre.DagreContext;
import com.wang.tool.dagre.node.DagreNode;

import java.util.Arrays;
import java.util.Collection;

/**
 * @Description
 * @Author shaopeng
 * @Date 2021/9/28
 * @Version 1.0
 */
public class UserFinder implements DagreNode<HomeReq> {

    @Override
    public Collection<String> getDependIds() {
        return FindWorkerEnum.USER.getDependCodes();
    }

    @Override
    public String getId() {
        return FindWorkerEnum.USER.name();
    }
    @Override
    public boolean isSync() {
        return true;
    }

    @Override
    public Object preCheck(DagreContext<HomeReq> context) {
        return null;
    }

    @Override
    public Object execute(DagreContext<HomeReq> context1) throws Exception {
        HomeReq param = context1.getParam();
//        Thread.sleep(123);
        param.setUid("cdscds");
        JSONObject object = new JSONObject();
        object.put("1", "1");
//        context1.cancelNode(FindWorkerEnum.CIRCLE2.name());
//        System.out.println("11111"+context1.cancelNode(FindWorkerEnum.SEA.name()));
//        System.out.println("222222"+context1.isCancel(FindWorkerEnum.SEA2.name()));

        return Arrays.asList(object);
    }
}
